import request from '@/config/axios'

// 考试试卷 VO
export interface PaperVO {
  id: number // id
  questionType: boolean // 题目顺序: 0 false 1true
  answerType: boolean // 答案顺序: 0 false 1true
  questionRandom: boolean // 从题库中随机题目：0 false 1true
  name: number // 试卷名称
  materialId: number // 题目分类
  passScore: number // 及格线
  durationTime: number // 考试时长(分钟)
}

// 考试试卷 API
export const PaperApi = {
  // 查询考试试卷分页
  getPaperPage: async (params: any) => {
    return await request.get({ url: `/exam/paper/page`, params })
  },

  // 查询考试试卷详情
  getPaper: async (id: number) => {
    return await request.get({ url: `/exam/paper/get?id=` + id })
  },

  // 新增考试试卷
  createPaper: async (data: PaperVO) => {
    return await request.post({ url: `/exam/paper/create`, data })
  },

  // 修改考试试卷
  updatePaper: async (data: PaperVO) => {
    return await request.put({ url: `/exam/paper/update`, data })
  },

  // 删除考试试卷
  deletePaper: async (id: number) => {
    return await request.delete({ url: `/exam/paper/delete?id=` + id })
  },

  // 导出考试试卷 Excel
  exportPaper: async (params) => {
    return await request.download({ url: `/exam/paper/export-excel`, params })
  },
}